package handlers

import (
	"cron-go/configs/error_code"
	"cron-go/internal/pkg/crontab/dao"
	"cron-go/internal/pkg/crontab/models"

	"github.com/go-liam/util/response"
)

type GetTask struct {
	ID    int64
	Model *models.TaskMysqlModel
	Resp  *TaskModelResp
}

func (s *GetTask) GetData() *response.APIResponse {
	s.Model, _ = new(dao.TaskDao).FindOneByID(s.ID)
	s.Resp = ChangeTaskModelToResp(s.Model)
	return &response.APIResponse{Code: error_code.Success, Message: error_code.MsSuccess, Data: s.Resp}
}
